package patterns.statePattern;

public abstract class Walkman {
	protected String name;
	protected String sex;
	protected Integer age;
	protected HumanHealthStatus status;
	protected TrafficLights trafficLights;

	protected Walkman(String name, String sex, Integer age, HumanHealthStatus status) {
		super();
		this.name = name;
		this.sex = sex;
		this.age = age;
		this.status = status;
	}

	public void meetTrafficLights(TrafficLights trafficLights) {
		this.trafficLights = trafficLights;
		trafficLights.addWalkman(this);
	}

	public void renouncePassTrafficLights() throws Exception {
		if (trafficLights == null) {
			System.out.println("you are not at trafficLights!");
		} else {
			trafficLights.deleteWalkman(this);
		}
	}

	public void waitNotice(String message) {
		// TODO Auto-generated method stub
		System.out.println(new StringBuffer("you are " + name + "\n").append(message).append("\n").toString());
	}

	public void passNotice(String message) {
		// TODO Auto-generated method stub
		System.out.println(new StringBuffer("you are " + name + "\n").append(message).append("\n").toString());
		this.trafficLights = null;
	}

	public void leaveNotice() {
		// TODO Auto-generated method stub
		System.out.println("you are " + name + "\n" + "在绿灯亮时你向相反方向离开了红绿灯\n");
	}

	public void passLinkNotice() {
		// TODO Auto-generated method stub
		System.out.println("当前是绿灯，你正在通过队列中\n");
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public HumanHealthStatus getStatus() {
		return status;
	}

	public void setStatus(HumanHealthStatus status) {
		this.status = status;
	}

}
